package cn.newtouch.feignclient;

import cn.newtouch.domian.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@FeignClient(value = "user-server",fallbackFactory = UserFallbackFactory.class)
@RequestMapping("/user")
public interface UserFeignClient {

    /**
     * 1.方法名称必须跟被代理接口一致
     * 2.接口的参数和返回值必须跟被代理方一致
     * 3.接口的请求方式必须跟被代理方一致
     * 4.以后直接去CV你要代理的接口方法即可
     * @param id
     * @return
     */
    @GetMapping("/getById/{id}")
    User getById(@PathVariable("id") Long id);

}
